<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%   String path = request.getContextPath();   
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
	String bpath = request.getScheme()+"://"+request.getServerName();
	String openId = (String)request.getSession().getAttribute("openId");
	if(openId==null || openId.equals("")){
	 	openId = (String)request.getParameter("openId");
	 	request.getSession().setAttribute("openId", request.getParameter("openId"));	
	}
	 
%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,,user-scalable=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="http://v3.bootcss.com/favicon.ico">
    <title>微会员</title>
    <link href="/bootstrapDemo/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="/bootstrapDemo/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
    <script src="/bootstrapDemo/js/jquery.js"></script>
    <script src="/bootstrapDemo/bootstrap/js/bootstrap.min.js"></script>
  </head>
  <script type="text/javascript">
  
  	//ajax保存
	function tosubmitAjax(frmid){
  		var WNickname = $("#WNickname").val();
  		var WSex = $("#WSex").val();
  		var WCity = $("#WCity").val();
  		var WPhone = $("#WPhone").val();
  		if(WNickname==null || WNickname=="" || WNickname=="undefined"){
  			alert("请填写用户昵称");
  		}else if(WSex==null || WSex=="" || WSex=="undefined"){
  			alert("请选择性别");
  		}else if(WCity==null || WCity=="" || WCity=="undefined"){
  			alert("请填写所在城市");
  		}else if(WPhone ==null || WPhone=="" || WPhone=="undefined"){
  			alert("请填写手机号");
  		}else{
  		var murl = "<%=basePath%>/user/registerUser.action";
  			var parmers = $("#"+frmid).serialize();
  			$.post(murl,parmers,function(boo){
  				if(boo){
  					 document.getElementById("successDiv").style.display="";
  					 location.href = "<%=basePath%>/user/getMemberInfo.action";
  				}else{
  					document.getElementById("failureDiv").style.display="";
  				}
  			}); 
  		}
	
	}
    </script>
  
<body >
<img src="/wpages/images/top-me.jpg" style="width: 100%;height: 70px;">
	<!-- 这里是头部的轮播插件 end-->
	  <div class="alert alert-success alert-dismissable" id="successDiv" style="margin: 0px;display:none ">
		   <button type="button" class="close" data-dismiss="alert" 
		      aria-hidden="true">
		      &times;
		   </button>
		  操作成功！您已经很好的完成了提交。
		</div>
		<div class="alert alert-warning alert-dismissable" id="failureDiv" style="margin: 0px;display:none ">
		   <button type="button" class="close" data-dismiss="alert" 
		      aria-hidden="true">
		      &times;
		   </button>
		   操作失败！请重新尝试。
		</div>
<div class="container" style="margin: 10px; padding: 0px;" >
	<div class="panel panel-primary">
		  <div class="panel-heading">会员绑定</div>
		  <div class="panel-body">
		  <form method="post" name="memberReisterFrm" id="memberReisterFrm" action="<%=basePath%>/user/registerUser.action">
			<table class="table">
			 	 <tr style="background-color: white;border: 0">
						<td >昵称</td>		
						<td >
						<input type="hidden" name="tuser.WOpenid"  class="form-control" id="WOpenid" value="${openId }">
						<input type="text" name="tuser.WNickname"  class="form-control" id="WNickname" placeholder="请填写昵称">
						</td>		
					</tr>
					<tr style="background-color: white;border: 0">
						<td >性别</td>		
						<td >
							<select class="form-control" name="tuser.WSex" id="WSex" >
							<option value="1">男</option>
							<option value="0">女</option>
						</select>
						</td>		
					</tr>
					<tr style="background-color: white;border: 0">
						<td >手机号</td>		
						<td ><input type="number" name="tuser.WPhone"  class="form-control" id="WPhone" placeholder="请填写手机号"></td>		
					</tr>
					<tr style="background-color: white;border: 0">
						<td >城市</td>		
						<td ><input type="text" name="tuser.WCity"  class="form-control" id="WCity" placeholder="请填写所在地"></td>		
					</tr>
					<tr style="background-color: white;border: 0">
						<td colspan="2">
			  				<button type="button" class="btn btn-primary" style="width: 100%" onclick="tosubmitAjax('memberReisterFrm');">提交</button>
						</td>		
					</tr>
			  </table>
			  </form>
	 	 </div>
	</div>
</div>
<div id="footer" style="height: 40px; text-align: center;">
 	<p>版权所有@功夫梦·中国 2014-2016</p>
 </div>

<div style="height: 30px;"></div>
<jsp:include page="/wpages/bottom.jsp"></jsp:include>

</body>
</html>